﻿<UserControl
    x:Class="WinRTXamlToolkit.Sample.Views.BindingDebugConverterTestView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WinRTXamlToolkit.Sample.Views"
    xmlns:controls="using:WinRTXamlToolkit.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:dconv="using:WinRTXamlToolkit.Debugging.Converters"
    mc:Ignorable="d">
    <UserControl.Resources>
        <dconv:BindingDebugConverter
            x:Key="BindingDebugConverterBreaksAlways"
            BreaksAlways="True"
            Traces="False" />
        <dconv:BindingDebugConverter
            x:Key="BindingDebugConverterBreaks" />
        <dconv:BindingDebugConverter
            x:Key="BindingDebugConverterTrace"
            Breaks="False" />
        <dconv:BindingDebugConverter
            x:Key="BindingDebugConverterSavesTrace"
            Breaks="False"
            SavesTrace="True" />
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition
                Width="22" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <StackPanel
            HorizontalAlignment="Left">
            <StackPanel
                Orientation="Horizontal">
                <ToggleButton
                    x:Name="BreakButton"
                    Content="Break if debugged"
                    IsChecked="{Binding IsChecked, ElementName=BreakButton2, Mode=TwoWay, Converter={StaticResource BindingDebugConverterBreaks}}" />
                <ToggleButton
                    x:Name="BreakButton2"
                    Content="Break if debugged" />
            </StackPanel>

            <StackPanel
                Orientation="Horizontal">
                <ToggleButton
                    x:Name="BreakAlwaysButton"
                    Content="Break always"
                    IsChecked="{Binding IsChecked, ElementName=BreakAlwaysButton2, Mode=TwoWay, Converter={StaticResource BindingDebugConverterBreaksAlways}}" />
                <ToggleButton
                    x:Name="BreakAlwaysButton2"
                    Content="Break always" />
            </StackPanel>

            <StackPanel
                Orientation="Horizontal">
                <ToggleButton
                    x:Name="TraceButton"
                    Content="Trace"
                    IsChecked="{Binding IsChecked, ElementName=TraceButton2, Mode=TwoWay, Converter={StaticResource BindingDebugConverterSavesTrace}}" />
                <ToggleButton
                    x:Name="TraceButton2"
                    Content="Trace" />
            </StackPanel>

            <StackPanel
                Orientation="Horizontal">
                <ToggleButton
                    x:Name="SaveTraceButton"
                    Content="Saves Trace"
                    IsChecked="{Binding IsChecked, ElementName=SaveTraceButton2, Mode=TwoWay, Converter={StaticResource BindingDebugConverterSavesTrace}}" />
                <ToggleButton
                    x:Name="SaveTraceButton2"
                    Content="Saves Trace" />
            </StackPanel>
        </StackPanel>

        <controls:CustomGridSplitter
            Grid.Column="1" />
        <ListBox
            ItemsSource="{Binding TraceLines, Source={StaticResource BindingDebugConverterSavesTrace}}"
            Grid.Column="2">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock
                        Text="{Binding}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>
